<?php
	$hostName = "localhost";
	$username = "root";
	$password = "";
	$databaseName = "qlhsdb";
?>
<?php
	function showError()
	{
		die("Error " . mysql_errno( ). " : " . mysql_error( ));
	}
?>
<?php
	$mahs = $_REQUEST["MaSo"];
	$hoten= $_REQUEST["Ten"];
	$diachi = $_REQUEST["DiaChi"];
	$dienthoai = $_REQUEST["DienThoai"];
	$ngaysinh = $_REQUEST["NgaySinh"];
	
	

	$cnn = mysql_connect( $hostName, $username, $password );
	if ( ! $cnn )
		showError();
             
    $dbselect = mysql_select_db( $databaseName);
    if(!$dbselect)
      	showError();            
			
				
	$table = "hocsinh";
	$query = "UPDATE  $table SET hoten='$hoten', diachi='$diachi', dienthoai='$dienthoai', ngaysinh='$ngaysinh' WHERE mahs='$mahs'";
	//$query = "UPDATE  $table SET hoten='$hoten', diachi='$diachi' WHERE mahs='$mahs'";
	$result = mysql_query($query, $cnn);
	
	if (mysql_affected_rows())
	{
		echo "1";
	}
	else
	{
		echo "0";
	}

	
?>